yufrontin
lightweight yaml front matter extractor using yaml.js
The core of yaml.js is included within the lib directory. I did not feel the need to use the entire repo as a dependency
when I would only use the core. This keeps the size of the project small. License file for yaml.js is included.
Installation
$ npm install yufrontin
Usage
yufrontin('---\ntitle: \'me\'\n---\nHello World')
{ data: { title: 'me' }, content: 'Hello World' }
yufrontin('Hello World')
{ data: {}, content: 'Hello World' }
or you could do this:
var fs = require('fs')
var parsefm = require('parse-yuf')
var file = fs.readFileSync('some/file/to/be/read.md', 'utf8')
yufrontin(file)
parsefm('some/file/to/be/read.md')
API
yufrontin(inputString)
- inputString [String] data to be parsed by yaml.js
- return [Object]
Why?
Why another yaml front matter extractor? I wanted to try yaml.js.
See Also
- parse-yuf: read in a file to be parsed by yufrontin returning an extended results or output from yaml.js
- gray-matter: My all time favorite YAML front matter parser before yufrontin.
- front-matter-extractor: the code base which yufrontin is shamelessly based on.
- yamljs: yaml engine used here.
License
ISC